<template>
	<div class="news">
		<h2>我是News组件</h2>
		<ul>
			<li v-for="news in newsList" :key='news.id' >{{news.title}}</li>
		</ul>
		<h3>学校名称: {{qwe}}</h3>
	</div>
</template>

<script>
	export default {
		name: 'News',
		data(){
			return{
				newsList:[
					{id:'001',title: '外交部：台湾省没资格加入联合国'},
					{id:'002',title: '美核潜艇撞了中国黄花鱼养殖箱?'},
					{id:'003',title: '暴雨致山西1763处古建受损'}
				],
				qwe:''
			}
		},
		mounted() {
			this.$bus.$on('haha',(val)=>{
				this.qwe = val
			})	
		},
		beforeDestroy(){
			this.$bus.$off('haha')
		}
	}
</script>

<style>
	.news{
		background-color: pink;
		padding: 20px;
	}
</style>